//
//  mmjLoginViewController.m
//  Social
//
//  Created by seirra on 2018/5/14.
//  Copyright © 2018年 mmj. All rights reserved.
//

#import "mmjLoginViewController.h"

@interface mmjLoginViewController ()

@end

@implementation mmjLoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //self.phoneField.tintColor = [UIColor whiteColor];
    //self.loginButton.layer.cornerRadius = 5;
    //[self.loginButton setValue:@5 forKey:@"layer.cornerRadius"];   //KVC
    
    //self.loginButton.layer.masksToBounds = YES;
    //[self.loginButton setValue:@YES forKey:@"layer.masksToBounds"];
    
    
}

-(UIStatusBarStyle)preferredStatusBarStyle{//设置状态栏样式
    return UIStatusBarStyleLightContent;
}


-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    //    [self dismissViewControllerAnimated:YES completion:nil];
    //隐藏这个界面上的所有输入状态
    [self.view endEditing:YES];
}
- (IBAction)ShowLoginOrRegister:(UIButton *)sender {
    // 退出键盘
    [self.view endEditing:YES];
    
    // 设置约束 和 按钮状态
    if (self.leftMargin.constant) { // 目前显示的是注册界面, 点击按钮后要切换为登录界面
        self.leftMargin.constant = 0;
        sender.selected = NO;
        //        [button setTitle:@"注册帐号" forState:UIControlStateNormal];
    } else { // 目前显示的是登录界面, 点击按钮后要切换为注册界面
        self.leftMargin.constant = - self.view.mmj_width;
        sender.selected = YES;
        //        [button setTitle:@"已有帐号?" forState:UIControlStateNormal];
    }
    
    // 动画
    [UIView animateWithDuration:0.25 animations:^{
        // 强制刷新 : 让最新设置的约束值马上应用到UI控件上
        // 会刷新到self.view内部的所有子控件
        [self.view layoutIfNeeded];
    }];
    
}

- (IBAction)close {
    [self.view endEditing:YES];
    [self dismissViewControllerAnimated:YES completion:nil];
}
@end
